package com.ecfront.test.dao;

import java.util.Iterator;
import java.util.List;
import junit.framework.TestCase;
import com.ecfront.dao.ShopStyleDAO;
import com.ecfront.pojo.ShopStyle;

public class testShopStyle extends TestCase {
	private static final ShopStyleDAO shopStyleDao = (ShopStyleDAO)SpringUtilTest.getBean("ShopStyleDAO");
	//保存测试
	public void testSave(){
		ShopStyle style = new ShopStyle();
		style.setFileUrl("/Css/ShopScc/blueSky.css");
		style.setTitle("蓝色天空");
		shopStyleDao.save(style);
	}
	//更新测试
	public void testUpdate(){
		ShopStyle style = new ShopStyle();
		style.setId(1);
		style.setFileUrl("/Css/ShopScc/blueSky.css");
		style.setTitle("蓝色天空-改");
		shopStyleDao.save(style);
	}
	//删除测试
	public void testDel(){
		ShopStyle style = new ShopStyle();
		style.setId(1);
		shopStyleDao.delete(style);
	}
	//根据ID得到
	public void testFindById(){
		ShopStyle style = shopStyleDao.findById(2);
		System.out.println(style.getFileUrl());
		System.out.println(style.getTitle());
	}
	//得到所有属性
	public void testFindAll(){
		List list = shopStyleDao.findAll();
		for(Iterator iter = list.iterator();iter.hasNext();){
			ShopStyle ss = (ShopStyle)iter.next();
			System.out.println(ss.getFileUrl());
			System.out.println(ss.getTitle());
		}
	}
	//指定属性获取
	public void testFindByProperties(){
		//List list = shopStyleDao.findBySstTitle("蓝色天空");
		List list = shopStyleDao.findBySstFileUrl("/Css/ShopScc/blueSky.css");
		for(Iterator iter = list.iterator();iter.hasNext();){
			ShopStyle ss = (ShopStyle)iter.next();
			System.out.println(ss.getFileUrl());
			System.out.println(ss.getTitle());
		}
	}
}
